﻿using System.Web.Mvc;
using CoinDev.Models;
using CoinDev.Models.JSON;
using CoinDev.Data;
using System.Collections;
using System.Collections.Generic;
using System.Data;

namespace CoinDev.Controllers
{
	[HandleError]
	public class HomeController : Controller
	{
		public ActionResult Index()
		{
            //ViewData["Message"] = "Welcome to ASP.NET MVC!";
            GetCategoryList();
			return View();
		}
		public ActionResult About()
		{
            GetCategoryList();
			return View();
		}
        public ActionResult Services()
        {
            GetCategoryList();
            return View("Services");
        }
        public ActionResult ContactUs()
        {
            GetCategoryList();
            return View("ContactUs");
        }

        public void GetCategoryList()
        {
            ArrayList Params = new ArrayList
            {
            };

            var dtCategories = Data.Connections.GetDataTable("Admin_Get_CategoryListDDL", Params, "ApplicationServices");

            var CategoryDDL = new List<SelectListItem>();

            CategoryDDL.Add(new SelectListItem { Text = "- Select -", Value = "" });

            foreach (DataRow drCategories in dtCategories.Rows)
            {
                CategoryDDL.Add(new SelectListItem { Text = drCategories["Name"].ToString(), Value = drCategories["Id"].ToString() });
            }

            ViewData["CategoryDDL"] = CategoryDDL;
        }
	}
}
